﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Cognex.VisionPro;
using Cognex.VisionPro.CalibFix;
using Cognex.VisionPro.ImageFile;
using Cognex.VisionPro.ImageProcessing;
using Cognex.VisionPro.OCRMax;
using Cognex.VisionPro.OCVMax;
using Cognex.VisionPro.PixelMap;
using Cognex.VisionPro.PMAlign;
using Cognex.VisionPro.Blob;
using Application = System.Windows.Forms.Application;
using Cognex.VisionPro.ID;
using Cognex.VisionPro.Caliper;
using Cognex.VisionPro.Implementation;
using Cognex.VisionPro.ToolBlock;

namespace Delta
{

    public partial class VisionSetForm : Form
    {
        public Form1 form1;

        public PMAlignToolForm Form_PMAlignTool;
        public AdvancedVisionForm advancedVisionForm;

        //禁用列表
        public List<string> UnEnabled = new List<string>();
      
        public VisionSetForm(Form1 form)
        {
            InitializeComponent();
            form1 = form;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form_PMAlignTool = new PMAlignToolForm(this);
            UnEnabled.Clear();
            Form_PMAlignTool.LoadBlock(Application.StartupPath + @"\Vpp\3225CF\DeltaVpp.vpp");
            Form_PMAlignTool.Show();
        }

        private void VisionSetForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            e.Cancel = true;
        }



        /// <summary>
        /// 初始化
        /// </summary>
        public void LoadadvancedVisionForm(string ToolType)
        {
            advancedVisionForm = new AdvancedVisionForm(this, ToolType);
        }


        private void btnCircle_Click(object sender, EventArgs e)
        {
            LoadadvancedVisionForm("Circle");
            advancedVisionForm.ShowDialog();  
        }

        private void btnLine_Click(object sender, EventArgs e)
        {
            LoadadvancedVisionForm("Line");
            advancedVisionForm.ShowDialog();
        }

        private void btnblob_Click(object sender, EventArgs e)
        {
            LoadadvancedVisionForm("blob");
            advancedVisionForm.ShowDialog();
        }

        private void btnCaliper_Click(object sender, EventArgs e)
        {
            
            LoadadvancedVisionForm("Caliper");
            advancedVisionForm.ShowDialog();
        }

        private void btnCameraSetting_Click(object sender, EventArgs e)
        {
          form1.triggerForm.ShowDialog();
        }

        private void btn_AdvancedSetting_Click(object sender, EventArgs e)
        {
         form1. formVpToolBlock.ShowDialog();
        }
    }
}
